//
//  DatasViewController.m
//  PT
//
//  Created by jarze on 15/6/13.
//  Copyright (c) 2015年 jarze. All rights reserved.
//

#import "DatasViewController.h"
#import "CYTViewController.h"
#define color (__bridge CGColorRef)([ UIColor colorWithRed:230 green:75 blue:83 alpha:1])

@interface DatasViewController ()
- (IBAction)next:(UIButton *)sender;
@property (nonatomic, assign) NSInteger ageTag;
@property (nonatomic, assign) NSInteger GenderTag;
@property (nonatomic, assign) NSInteger learningPurposeTag;
@property (nonatomic, assign) NSInteger educationBackgroundTag;
@property (nonatomic, strong) UIButton *lastSelectAgeButton;
@property (nonatomic, strong) UIButton *lastSelectGenderButton;
@property (nonatomic, strong) UIButton *lastSelectlearningPurposeButton;
@property (nonatomic, strong) UIButton *lastSelecteducationBackgroundButton;


@end

@implementation DatasViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
//      _age1.layer.borderWidth = 1;
//    _age1.layer.cornerRadius = 10.0;
//    _age1.layer.masksToBounds = YES;
//    
//
//    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
//    CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){1, 0, 0, 1 });
    
  //  [_age1.layer setBorderColor:colorref];//边框颜色
    [self setBtnStyle:_age1];
    [self setBtnStyle:_age2];
    [self setBtnStyle:_age3];
    [self setBtnStyle:_gender1];
    [self setBtnStyle:_gener2];
    [self setBtnStyle:_background1];
    [self setBtnStyle:_background2];
    [self setBtnStyle:_background3];
    [self setBtnStyle:_background4];
    [self setBtnStyle:_purposes1];
    [self setBtnStyle:_purposes2];
    [self setBtnStyle:_purposes3];
    [self setBtnStyle:_purposes4];
    
  

   
//    [_age1 setTitleColor:(__bridge UIColor *)(color) forState:UIControlStateSelected];
//    
//    [_age1.layer setBorderColor:color];

}

- (UIButton *)setBtnStyle:(UIButton *)btn
{
//    UIImage *image = [[UIImage imageNamed:@"unselectButton17"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [btn setBackgroundImage:[UIImage imageNamed:@"unselectButton17"] forState:UIControlStateNormal];
    
//    UIImage *selectImage = [[UIImage imageNamed:@"selectButton17"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [btn setBackgroundImage:[UIImage imageNamed:@"selectButton17"] forState:UIControlStateSelected];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
  return btn;


}
- (IBAction)ageSelectButton:(UIButton *)sender {
    _ageTag = sender.tag;
    _lastSelectAgeButton.selected = NO;
    sender.selected = YES;

    _lastSelectAgeButton = sender;
}

- (IBAction)genderSelectButton:(UIButton *)sender {
    _GenderTag = sender.tag;
    _lastSelectGenderButton.selected = NO;
    sender.selected = YES;
    
    _lastSelectGenderButton = sender;
}

- (IBAction)learningPurposeSelectButton:(UIButton *)sender {
    _learningPurposeTag = sender.tag;
    _lastSelectlearningPurposeButton.selected = NO;
    sender.selected = YES;
    
    _lastSelectlearningPurposeButton = sender;
}

- (IBAction)educationBackgroundSelectButton:(UIButton *)sender {
    _educationBackgroundTag = sender.tag;
    _lastSelecteducationBackgroundButton.selected = NO;
    sender.selected = YES;
    
    _lastSelecteducationBackgroundButton = sender;
}


- (IBAction)next:(UIButton *)sender {
//    if( _lastSelectAgeButton && _lastSelectGenderButton&&_lastSelectlearningPurposeButton&& _lastSelecteducationBackgroundButton) {
//        CYTViewController *CT = [[CYTViewController alloc] init];
//        [self.navigationController pushViewController:CT animated:YES];
//    }
    //以下代码测试用。。。完成后请删除并回复上方代码
    CYTViewController *CT = [[CYTViewController alloc] init];
    [self.navigationController pushViewController:CT animated:YES];
}

@end
